<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <input id="num1" type="text" placeholder="请输入数字">
    <select name="" id="sel">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
        <option value="%">%</option>
    </select>
    <input id="num2" type="text" placeholder="请输入数字">
    <input id="equal" type="submit" value="=">
    <input id="res" type="text" placeholder="结果">


    <script src="../js/tool2.js"></script>
    <script>

        // 拿对象
        var oNum1 = getEle('num1'); 
        var oSel = getEle('sel') ;
        var oNum2 = getEle('num2'); 
        var oBtn = getEle('equal'); 
        var oRes = getEle('res');

        // 写点击事件
        oBtn.onclick = function() {
            // 获取输入框的值
            var n1 = oNum1.value * 1 ;
            var n2 = oNum2.value * 1 ;
            var symbol = oSel.value ;

            oRes.value = calc(n1 , n2 , symbol) ;
        }




        // 随机产生两个数  --- 计算他们的和

        var x = rand(0,100) ;
        var y = rand(0,100) ;
        var res = calc(x , y , '+') ;







        // 随机产生一个10位以内的数，打印这么多行的直角三角形

       
            // var n1 = parseInt(Math.random() * 10) ;
            // for(var i = 0 ; i < n1 ; i++) {
            //     ...
            // }

        var n1 = rand(0,10) ;
        sanJiao(n1 , '*') ;
        



    </script>
    
</body>
</html>